package it.trekker.gps;

import java.util.ArrayList;
import java.util.List;

import android.location.Location;
import android.location.LocationListener;
import android.os.Bundle;

public class GPSLocationListenerMap implements LocationListener {

	private List<TrackListener> trackListeners = null;
	
	public GPSLocationListenerMap() {
		trackListeners = new ArrayList<TrackListener>();
	}
	
	@Override
	public void onLocationChanged(Location location) {
		for(TrackListener listener : trackListeners) {
			listener.updateLocation(location);
		}
	}

	@Override
	public void onProviderDisabled(String provider) {
	}

	@Override
	public void onProviderEnabled(String provider) {
	}

	@Override
	public void onStatusChanged(String provider, int status, Bundle extras) {
	}
	
	public void addListener(TrackListener listener) {
		trackListeners.add(listener);
	}

	public void removeListener(TrackListener listener) {
		trackListeners.remove(listener);
	}
}
